﻿@using NewsMine.DomainObjects;
@{
    
    ViewBag.Title = "Look at news";
    // Layout = "~/Views/Shared/_Layout.cshtml";

    QResult DataFromController = (QResult)Model;

    string previousPageLink = DataFromController.CurrentUrl + "&pgno=" + (DataFromController.PageNumber - 1).ToString();
    string nextPageLink = DataFromController.CurrentUrl + "&pgno=" + (DataFromController.PageNumber + 1).ToString();

     string selectedLanguage = ((QResult)Model).CurrentLanguage;
     
    Layout = "~/Views/Shared/_3ColumnMasterLayout.cshtml";
    
}
<script src="@Url.Content("~/scripts/blocksit.js")"></script>
<script>

    window.setInterval(yourfunction, 10000);

    var numberOfColumns = 3;

    function yourfunction() { $(window).resize(); }

    $(document).ready(function () {

        var w = $(window).width() + "px";

        $('body').css('width', w);
        $('body').css('padding', '30px');

        $("#container").css('width', w);
        $("#websiteContainer").css('width', w);


        $('#container').BlocksIt({
            numOfCol: numberOfColumns,
            offsetX: 10,
            offsetY: 10
        });

        $('#websiteContainer').BlocksIt({
            numOfCol: 6,
            offsetX: 10,
            offsetY: 10
        });

        //        $("#container").width = $(window).width();
        //        $('#websiteContainer').width = $(window).width();
        $(window).resize();

        //blocksit define
        $(window).load(function () {

            var w = $(window).width() + "px";

            $('body').css('width', w);
            $('body').css('padding', '30px');

            $("#container").css('width', w);
            $("#websiteContainer").css('width', w);

            $(window).resize();

            //            $('#container').BlocksIt({
            //                numOfCol: numberOfColumns,
            //                offsetX: 10,
            //                offsetY: 10
            //            });

            //            $('#websiteContainer').BlocksIt({
            //                numOfCol: 6,
            //                offsetX: 10,
            //                offsetY: 10
            //            });



        });

        //window resize
        var currentWidth = $(window).width();

        $(window).resize(function () {

            var w = $(window).width() + "px";

            $('body').css('width', w);
            $('body').css('padding', '30px');

            $("#container").css('width', w);
            $("#websiteContainer").css('width', w);

            // $('#websiteContainer').width = $(window).width();
            $('#websiteContainer').BlocksIt({
                numOfCol: 6,
                offsetX: 10,
                offsetY: 10
            });

            var winWidth = $(window).width();
            var conWidth;
            if (winWidth < 660) {
                conWidth = 440;
                col = 1
            } else if (winWidth < 880) {
                conWidth = 440;
                col = 1;
            } else if (winWidth < 1000) {
                conWidth = 880;
                col = 2;
            } else if (winWidth < 1100) {
                conWidth = 1000;
                col = numberOfColumns;
            }
            else if (winWidth > 1100) {
                conWidth = 1100;
                col = numberOfColumns;
            }
            else {
                conWidth = 1100;
                col = numberOfColumns;
            }

            conWidth = winWidth;

            if (conWidth != currentWidth) {
                currentWidth = conWidth;
                $('#container').width(conWidth);
                $('#container').BlocksIt({
                    numOfCol: col,
                    offsetX: 10,
                    offsetY: 10
                });
            }
        });
    });



   

</script>

    <section id="wrapper">

   
   
   @if (DataFromController.CurrentDomain != null)
   {
       <div style="text-align:center;margin-bottom:10px;border-top:3px double lightgrey;border-bottom:3px double lightgrey;text-shadow:0 1px 0 #ccc,
0 2px 0 #c9c9c9,
0 3px 0 #bbb,
0 4px 0 #b9b9b9,
0 5px 0 #aaa,
0 6px 1px rgba(0,0,0,.1),
0 0 5px rgba(0,0,0,.1),
0 1px 3px rgba(0,0,0,.3),
0 3px 5px rgba(0,0,0,.2),
0 5px 10px rgba(0,0,0,.25),
0 10px 10px rgba(0,0,0,.2),
0 20px 20px rgba(0,0,0,.15);">
       <h1> <img style="max-height:100px;" class="img-rounded" src="@DataFromController.CurrentDomain.Logo1Uri" />  @DataFromController.CurrentDomain.Name</h1>
       </div>
   }
           
          @* <div style="text-align:right;margin:15px;">
<a id="grid_view_icon" class="btn btn-large btn-inverse" href="../home/Default"  title="Grid"><i class="icon-th-large icon-white"></i> Grid</a>
<a id="list_view_icon" class="btn btn-large " href="../home/Index"  litle="List"><i class="icon-th-list"></i> List</a>
</div>      *@
   
 <hr />

  @RenderPage("~/views/shared/_pagerView.cshtml")

  

<div id="container" style="background-color:rgb(239, 240, 255);">

@{
    List<FeedItem> feeds = ((QResult)Model).FeedItems;


    string webSiteIconUrl = "https://plus.google.com/_/favicon?alt=feed&domain=eenj.net";
    
    
   @* <div class="grid" style="display:none;">
    <h2>News Sources</h2>
    
    @{
        List<NewsMine.DomainObjects.WebSiteInfo> websites = new List<NewsMine.DomainObjects.WebSiteInfo>();

        websites = ((QResult)Model).Websites;

        foreach (var website in websites)
        {
            continue;
            <h3>
        <a class='btn-link' style="margin:5px;padding-right:5px;" href="?domain=@website.Domain" >
                        <img src='https://plus.google.com/_/favicon?alt=feed&domain=@website.Domain ' style="padding-right:8px;width:20px;"/>@Html.Raw(website.Name)
                    </a>
               </h3>   
        }
            }
    </div>*@
    
    
    if (feeds == null || feeds.Count == 0)
    {
        <div class="grid" data-size="4">
            <h2>Feed not found for the selected criteria.</h2>
            </div>
    }

@*    <div class="grid">
<a href="http://www.googleadservices.com/pagead/aclk?sa=L&amp;ai=C35q0u1WQUf6zDKG9igf4jIHAAezd84UDlMn920Xc_qezogEQASAAUJmCtpQHYOWS6IPYDoIBFWNhLWRpZ2l0YWxpbnNwaXJhdGlvbogBAaAB4uG1_wPIAQKoAwGqBF9P0NFn4dnDx0df9UwqfUPBPJEnK173RsvBjj75CfHcV53xjLKyaSDXma-UGw53eoNfIP2vVX6badHQAULVG4O4yjElybAcPOBHiVr3UsBiUZ2eLeoZoBw6c8QckAtT8ogGAaAGAoAHhp5K&amp;num=1&amp;cid=5GipSI90_JiEQ0KunQRuGuvT&amp;sig=AOD64_3Z0S5AQcoFEAIcKakWuhe13YOZrg&amp;client=ca-digitalinspiration&amp;adurl=http://dyn.com/email%3F_kk%3D%26_kt%3D0de6fce7-798b-43aa-b337-4834f9ae702c" target="_blank"><img border="0" src="http://pagead2.googlesyndication.com/simgad/16296545325368595607" width="250" height="250"></a>
    </div>
*@    
    for (int i = 0; i < feeds.Count; i++)
    {
        int reminder = i % 10;
        Random rnd = new Random(i*i);
        int minValue = 80;
        int gapValue = 200 - minValue;

        string temp = (minValue + rnd.Next(reminder, gapValue)).ToString() + "," +
            (minValue + rnd.Next(reminder, gapValue)).ToString() + "," +
            (minValue + rnd.Next(reminder, gapValue)).ToString() ;

        string color = "rgb(" + temp + ")";
        string colorWithTrans = "rgba(" + temp + ",0.5)";

        //string colorWithTrans = "rgba(" + (minValue + rnd.Next(reminder, gapValue)).ToString() + "," +
        //   (minValue + rnd.Next(reminder, gapValue)).ToString() + "," +
        //   (minValue + rnd.Next(reminder, gapValue)).ToString() + ",0.9)";
        
        <div class="grid" style="border:1px solid @color">
        <div style="background-color:@color;height:3px;"></div>

        <div style="margin-left:10px;margin-right:10px;margin-bottom:-1px;color:#000;background-color:transparent;padding-left:3px;padding-right:3px;padding-top:1px;padding-bottom:3px;">
         <span class="pull-left">
         <img src="https://plus.google.com/_/favicon?alt=feed&amp;domain=@feeds[i].Domain " style="height:24px;width:24px;" alt="@feeds[i].Domain"/>
         <a class="btn btn-link" style="text-decoration: none;color:#500;" href="/source/@feeds[i].Domain"> <i>@feeds[i].Domain</i></a>
         </span>
         <span class="pull-right"> <span class="icon-time"></span>  <b><i class="timeago" title="@feeds[i].PubDate.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fff'Z'")">
                                                @feeds[i].PubDate</i> </b> &nbsp;ago&nbsp; </span>
        
        </div>
        
        <hr style="margin-bottom:1px;" color="white" />

         @*<div class="meta" style="background-color:#FFF;margin-top:10px;margin-left:10px;margin-right:10px;margin-bottom:-4px;padding:3px;color:#000;text-align:center;">

          @if (!string.IsNullOrEmpty(feeds[i].category))
          {
        <a style="color:#000" href="/category/@selectedLanguage-@feeds[i].category.Trim(',')"><b>@feeds[i].category.Trim(',').ToUpper()</b></a>
          }

        </div>
        <hr style="margin:5px;" />*@

           <div title="@Html.Raw(feeds[i].Title)" style="overflow: hidden;line-height: 1.6; height: auto;margin-left:10px;margin-right:10px;padding:10px;font-size:21px; text-align:left;font-family:'MuseoSans','Baumans'">
@*<img class="pull-left" src="https://plus.google.com/_/favicon?alt=feed&amp;domain=@feeds[i].Domain " style="height:24px;width:24px;margin-right:20px;" alt="@feeds[i].Domain"/>*@

        <a class="name" style="text-decoration: none;color:#000000;text-shadow:0px 0px 8px @colorWithTrans;" target="_blank" href="/go?t=@HttpUtility.UrlEncode(feeds[i].Title.Replace("+","-"))&u=@HttpUtility.UrlEncode(feeds[i].Link)">
        @Html.Raw(feeds[i].Title)   </a></div>


           @if (!string.IsNullOrEmpty(feeds[i].ImageUrl) && false)
           {

		<div class="imgholder" style="padding:10px;text-align:center;min-width:200px;min-height:auto;max-height:200px;margin-left:auto;margin-right: auto;margin-bottom:5px;vertical-align: text-top;overflow:hidden;">

			<img style="min-width:auto;max-height:250px; margin-left:auto;margin-right: auto; opacity:0.7;filter:alpha(opacity=95);"  src="@feeds[i].ImageUrl" />
@*			<img style="border-radius:25px;min-width:200px;min-height:100px;max-height:200px;margin-left:auto;margin-right: auto;"  src="@feeds[i].ImageUrl" />*@
			@*<img style="border-radius:25px;min-width:200px;min-height:100px;max-height:200px;margin-left:auto;margin-right: auto;"  src="@Url.Content("~/content/img/white.gif")" data-original="@feeds[i].ImageUrl" />*@
            
            
		</div>
           }
           else
           {
                <div></div>
           }
       @* <div style="background-color:#77BB55;height:4px;margin-left:10px;margin-right:10px;margin-top:-8px;"></div>
        *@

     
     

       
       
          
        
	</div>
        
    }
        }
</div>


 @RenderPage("~/views/shared/_pagerView.cshtml")

<div style="width:100%;height:auto;border:1px solid grey;background-color:#888888;text-align:center;">
<h2 style="color:white;">OUR RESPECTFUL NEWS SOURCES</h2>
</div>

 <div id="websiteContainer" style="width: 1100px;position:relative;margin:0 auto 25px;background-color:#fff;border-top:#000;">
    
      @{
                
          List<NewsMine.DomainObjects.WebSiteInfo> websites1 = new List<NewsMine.DomainObjects.WebSiteInfo>();

          websites1 = ((QResult)Model).CurrentLanguageWebsites;

          foreach (var website in websites1)
          {

              if (!string.IsNullOrEmpty(website.Logo1Uri))
              {
                   
                <div class="grid" style="border-radius:25px;text-align:center;position:relative;border:0px solid lightgrey;">
		        
               @* <p>@website.Language</p>*@

                      <a class="name" style="text-decoration:none;text-align:center;left:50%;top:50%;" target="_self" href="/source/@website.Domain">

			        <img style="max-width:auto;max-height:50px;margin-left:auto;margin-right: auto;" Title="@Html.Raw(website.Name)" src="@website.Logo1Uri" />
                     @*  <h5> @Html.Raw(website.Name) </h5>  *@    
                
                </a>
              </div>

              }

          }

       }

    </div>


</section>
    <!-- Footer -->
    <footer id="footer" style="display: none;">
	<span>&copy; 2013 <a href="#">lookatnews.com</a>. Design by <a href="#contact">Surendra</a></span>
</footer>
